package com.byapp.fast.amqp.receiver;


import com.byapp.fast.modules.match.dto.MatchMsgEventDTO;
import com.byapp.fast.modules.match.service.MatchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "#{matchHandicapQueue.name}")
@Slf4j
public class MatchHandicapEventReceiver {

    @Autowired
    private MatchService matchService;

    @RabbitHandler
    public void receive(MatchMsgEventDTO matchMsgEventDTO) {
        log.info("【赛事盘口】消息处理开始");
        matchService.updateMatchOdds(matchMsgEventDTO);
        log.info("【赛事盘口】消息处理结束");
    }
}
